//
//  AATransitionVC.m
//  JinFuThree
//
//  Created by 毛韶谦 on 2018/9/10.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "AATransitionVC.h"

@interface AATransitionVC ()

@property (nonatomic, strong) UIImageView *showImageView;
@property (nonatomic, strong) UILabel *midLabel;
@property (nonatomic, strong) UILabel *bottomLabel;

@end

@implementation AATransitionVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initNavigationBar];
    [self initUI];
    // Do any additional setup after loading the view.
}

- (void)initNavigationBar {
    
    self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    
    UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeSystem];
    [button1 setImage:[[UIImage imageNamed:@"BackArrow"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    button1.frame = CGRectMake(0, 2.5, 30, 41.5f);
    [button1 addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    
    [backgroundView addSubview:button1];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backgroundView];
}
- (void)backAction {
    
    if (self.showType == AATransitionShowTypeFail) {
        [self.navigationController popViewControllerAnimated:YES];
    }else {
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
}


- (void)initUI {
    
    self.title = @"高级实名认证";
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self.showImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(130, 165));
        make.centerX.mas_equalTo(self.view);
        make.centerY.mas_equalTo(self.view.mas_bottom).multipliedBy(0.25f);
    }];
    [self.midLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view);
        make.top.mas_equalTo(self.showImageView.mas_bottom).offset(16);
    }];
    [self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view);
        make.top.mas_equalTo(self.midLabel.mas_bottom).offset(8);
    }];
    switch (self.showType) {
        case AATransitionShowTypeSucceed:
        {
            self.showImageView.image = [UIImage imageNamed:@"sub success"];
            self.midLabel.text = @"提交成功";
            self.bottomLabel.text = @"您的信息已提交成功, 请耐心等待审核";
        }
            break;
        case AATransitionShowTypeFail:
        {
            self.showImageView.image = [UIImage imageNamed:@"sub failure"];
            self.midLabel.text = @"提交失败";
            self.bottomLabel.text = @"提交申请失败, 刷新重试";
        }
            break;
            
        default:
            break;
    }

}



- (UIImageView *)showImageView {
    
    if (!_showImageView) {
        _showImageView = [[UIImageView alloc] init];
        [_showImageView setContentMode:UIViewContentModeScaleAspectFit];
        
        [self.view addSubview:_showImageView];
    }
    return _showImageView;
}

- (UILabel *)midLabel {
    
    if (!_midLabel) {
        _midLabel = [[UILabel alloc] init];
        _midLabel.font = [UIFont boldSystemFontOfSize:16];
        _midLabel.textColor = HexColor(0x333333);
        [_midLabel setTextAlignment:NSTextAlignmentCenter];
        
        [self.view addSubview:_midLabel];
    }
    return _midLabel;
}
- (UILabel *)bottomLabel {
    
    if (!_bottomLabel) {
        _bottomLabel = [[UILabel alloc] init];
        _bottomLabel.font = [UIFont systemFontOfSize:14];
        _bottomLabel.textColor = HexColor(0x666666);
        [_bottomLabel setTextAlignment:NSTextAlignmentCenter];
        
        [self.view addSubview:_bottomLabel];
    }
    return _bottomLabel;
}







- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
